import request from '@/utils/request'
import upload from '@/utils/upload.js'

//获取用户状态，是否实名认证或委托人认证
export const judgeIdentify = (data) => {
	return request({
		url: '/app/isRealAuth',
		data,
		method: 'get'
	})
}

// 司机查询运单发运完整信息集合（含分页）
export const getDriverTask = (data) => {
	return request({
		url: '/app/waybillShip/getDriverWaybillShipInfoPage',
		data,
		method: 'post'
	})
}

// 查看打卡
export const getWaybillClock = (data) => {
	return request({
		url: '/waybillShip/getWaybillShipClock',
		method: 'post',
		data
	})
}

// 起运
export const DepartureWaybill = (data) => {
	return request({
		url: '/app/waybillShip/departure',
		method: 'post',
		data
	})
}

// 到达
export const ReachWaybill = (data) => {
	return request({
		url: '/app/waybillShip/waybillShipArrive',
		method: 'post',
		data
	})
}

// 上传回单
export const receiptWaybill = (data) => {
	return request({
		url: '/app/waybillShip/receipt',
		method: 'post',
		data
	})
}

// 取消订单
export const CancelWaybillShip = (data) => {
	return request({
		url: '/app/waybillShip/driverCancelWaybillShip',
		method: 'post',
		data
	})
}

// 使用运单码
export const useWaybillShipCode = (data) => {
	return request({
		url: '/waybill/code/useCode',
		method: 'post',
		data
	})
}

// 接单(不签署合同，直接接单)
export const SignForWaybill = (data) => {
	return request({
		url: '/app/waybillShip/receiveSignFor',
		method: 'post',
		data
	})
}

// 查询委托信息集合
export const getAssignor = (data) => {
	return request({
		url: '/app/assignor/info/getDriverAssignorInfoPage',
		data,
		method: 'post'
	})
}

// 创建并签署委托合同
export const SignContract = (data) => {
	return request({
		url: '/app/assignor/info/createSignAssignorContract',
		data,
		method: 'post'
	})
}

// 已关联企业列表
export const Entlist = (data) => {
	return request({
		url: '/app/truckDriver/getRelateEnt',
		method: 'get',
		data
	})
}

// 查找个人信息
export const getInfo = (query) => {
	return request({
		url: '/app/truckDriver/getTruckerDriver',
		params: query,
		method: 'get'
	})
}

// 实名认证
export const toAuth = (data) => {
	return request({
		url: '/app/truckDriver/updateTruckerDriver',
		data,
		method: 'post'
	})
}

// 查询企业是否被关联
export const haslinkEnt = (relateEntCode) => {
	return request({
		url: '/app/truckDriver/verifyDriverHasRelateEnt',
		method: 'post',
		data: {
			relateEntCode
		}
	})
}

// 关联企业
export const linkEnt = (relateEntCode) => {
	return request({
		url: '/app/truckDriver/useTruckerDriverCode',
		data: {
			relateEntCode
		},
		method: 'post'
	})
}

// 活体验证上传视频
export const authVideo = (filePath, formData) => {
	return upload({
		url: '/app/assignor/videoRealAuth',
		filePath,
		formData,
		timeout: 3000 * 1000
	})
}

// 获取司机安心签开户状态
export const getAnxinqianOpenStatus = () => {
	return request({
		url: '/app/truckDriver/findUserAnxinqianInfo',
		method: 'get'
	})
}

// 司机安心签开户
export const openAnxinqian = (data) => {
	return request({
		url: '/app/truckDriver/openAnxinqian',
		method: 'post',
		data
	})
}

// 司机安心签发送验证码
export const getAnxinqianCode = (data) => {
	return request({
		url: '/app/anxinqian/sendVerifyCode',
		method: 'get',
		data
	})
}

// 验证司机安心签验证码
export const confirmAnxinqianCode = (data) => {
	return request({
		url: '/app/truckDriver/confirmVerifyCode',
		method: 'get',
		data
	})
}

// 修改委托人证件信息
export const updateAssignorInfo = (data) => {
	return request({
		url: '/app/assignor/updateUserInfo',
		method: 'post',
		data
	})
}

// 修改回单
export const updateReceiptWaybill = (data) => {
	return request({
		url: '/app/waybillShip/updateReceipt',
		method: 'post',
		data
	})
}

// 分片视频校验
export const chunksInspection = (fileName) => {
	return request({
		url: '/fileInfo/check?fileName=' + fileName,
		method: 'get'
	})
}

// 新活人认证
export const videoRealAuthNotFile = (data, fileName) => {
	return request({
		url: '/app/assignor/videoRealAuthNotFile',
		method: 'post',
		data: {
			...data,
			realStatus: 'DRIVER_REAL',
			fileName
		},
		timeout: 1800000
	})
}

// 查询收款账号余额
export const getmoney = (data) => {
	return request({
		url: '/beneficiaryAccountNo/getBalance',
		method: 'post',
		data
	})
}

// 发送绑定银行卡短信验证码
export const bindSmsCode = (data) => {
	return request({
		url: '/app/assignor/sendBindSmsCode',
		method: 'post',
		data
	})
}

// 委托人添加银行卡
export const addBankCard = (data) => {
	return request({
		url: '/app/assignor/saveUserAccountNo',
		data,
		method: 'post'
	})
}

// 获取银行列表
export const getBankList = (data) => {
	return request({
		url: '/app/assignor/getSuperBankCodePage',
		method: 'post',
		data
	})
}

// 绑定提现账户小额鉴权（发送验证短信）
export const getSmallAmountCode = (data) => {
	return request({
		url: '/app/assignor/bindSmallAmountWithCheckCorp',
		method: 'post',
		data
	})
}

// 小额鉴权回填金额（填写短信验证信息）
export const checkAmountWithCorp = (data) => {
	return request({
		url: '/app/assignor/checkAmountWithCorp',
		method: 'post',
		data
	})
}

// 委托人查询银行卡集合
export const accountNoPage = () => {
	return request({
		url: '/app/assignor/getUserAccountNoPage',
		data: {},
		method: 'post'
	})
}

// 提现收款子账号金额到个人银行卡
export const reflbankcard = (data) => {
	return request({
		url: '/app/assignor/withdrawUserAccountNo',
		data,
		method: 'post'
	})
}

// 发送提现短信验证码
export const withdrawSmsCode = (data) => {
	return request({
		url: '/app/assignor/sendWithdrawSmsCode',
		method: 'post',
		data
	})
}

// 用户查询银行提现信息
export const getWithdrawalRecord = (data) => {
	return request({
		url: '/app/assignor/getUserTransationPageByUser',
		method: 'post',
		data
	})
}

// 获取签约中心协议
export const getAgreement = (data) => {
	return request({
		url: '/app/contract/getUserContractPage',
		method: 'post',
		data
	})
}

// 保存运单评论
export const saveComment = (data) => {
	return request({
		url: '/app/waybill/addComment',
		method: 'post',
		data
	})
}

// 查询运单评价
export const getComment = (params) => {
	return request({
		url: '/app/waybill/listComment',
		method: 'get',
		params
	})
}

// 委托人认证
export const authentication = (data) => {
	return request({
		url: '/app/assignor/updateFile',
		method: 'post',
		data
	})
}

// 委托人活体验证上传视频
export const assignorAuthVideo = (filePath, formData) => {
	return upload({
		url: '/app/assignor/videoRealAuth',
		filePath,
		formData: {
			...formData,
			realStatus: 'ASSIGNOR_REAL'
		},
		timeout: 3000 * 1000
	})
}

// 运单推送位置
export const pushPosition = (data) => {
	return request({
		url: '/app/waybillShip/saveVehicleTrajectory',
		method: 'post',
		data
	})
}